package com.shitoujiandaobu.work;

import java.util.Scanner;

public class Ishitoujiandaobuiml implements Ishitoujiandaobu{

    public void ShiTouJianBudao(){
        Scanner reader = new Scanner(System.in);
        System.out.println("请出拳（提示：出1石头，出2为剪刀，出3为布）：");
        int myChoice = reader.nextInt();
        switch (myChoice) {
            case 1:
                System.out.println("您出的是石头");
                break;
            case 2:
                System.out.println("您出的是剪刀");
                break;
            case 3:
                System.out.println("您出的是布");
                break;
        }
        System.out.println("轮到电脑出拳");
        int pcChoice = (int) (Math.random() * 3 + 1);
        switch (pcChoice) {
            case 1:
                System.out.println("电脑出的是石头");
                break;
            case 2:
                System.out.println("电脑出的是剪刀");
                break;
            case 3:
                System.out.println("电脑出的是布");
                break;
        }
        int a = myChoice - pcChoice;
        switch (a) {
            case -1:
            case 2:
                System.out.println("你赢了！");
                break;
            case 0:
                System.out.println("平局");
                break;
            case -2:
            case 1:
                System.out.println("你输了！");
                break;
        }
    }
}
